
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>图层切换</title>
    <link rel="stylesheet" type="text/css" href="../css/leaflet.css"  media="all"/>
    <script type="text/javascript" src="../js/resources.js"></script>
    <script type="text/javascript" src="../js/leaflet.js"></script>
    <script type="text/javascript" src="../js/iclient-leaflet.js"></script>
    <style>
        .leaflet-control-layers.leaflet-control {
            margin-right: 60px;
        }
    </style>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript">
    var host = "https://iserver.supermap.io";

    var BJ = L.marker([39.830660058696104, 116.92866163503169]).bindPopup(window.examplesResources.resources.text_beijingCity),
        CD = L.marker([30.40, 104.04]).bindPopup(window.examplesResources.resources.text_chengdu);
    var cities = L.layerGroup([BJ, CD]);
    var China = L.supermap.tiledMapLayer(host + '/iserver/services/map-china400/rest/maps/China', {noWrap: true});
    var ChinaDark = L.supermap.tiledMapLayer(host + '/iserver/services/map-china400/rest/maps/ChinaDark', {noWrap: true});
    var map = L.map('map', {
        center: {lon: 0, lat: 0},
        maxZoom: 18,
        zoom: 2,
        zoomControl: false,
        layers: [China, cities]
    });
    var baseMaps = {
        "China": China,
        "ChinaDark": ChinaDark
    };
    var overlayMaps = {
        "Cities": cities
    };
    L.control.layers(baseMaps, overlayMaps).addTo(map);
</script>
</body>
</html>